#include "clickablewidget.h"
#include <QtGui>

//constructor
clickableWidget::clickableWidget(QWidget *parent)
        :QWidget(parent)
{
    //QWidget::setMouseTracking(true);
}

/* This method gets called when the mouse is pressed
 * In turn it emits a clicked signal which will be handled in the main window
 */
void clickableWidget::mousePressEvent(QMouseEvent *event)
{

    if(event->button() == Qt::LeftButton)// --- to check which button was pressed
    {
        emit clicked();
    }
}

/* This method gets called when the mouse is double clicked
 * In turn it emits a doubleClicked signal which will be handled in the main window
 */
void clickableWidget::mouseDoubleClickEvent(QMouseEvent *event)
{
    if(event->button() == Qt::LeftButton)// --- to check which button was pressed
    {
        emit doubleClicked();
    }
}


//destructor
clickableWidget::~clickableWidget()
{
    //no dynamic memory, so we do nothing here.
}
